package com.github.dengmin.mysql.dto;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @Author dengmin
 * @Created 2020/6/29 下午5:34
 */
public class ExecuteSql implements Serializable {
    private static final long serialVersionUID = 1L;
    @NotNull(message = "执行的sql不能为空")
    private String sql;
    private Integer pageNo = 1;
    private Integer pageSize = 50;
    private String db;
    private Integer resourceId;

    public String getSql() {
        String tmp = sql.trim();
        int index = tmp.lastIndexOf(";");
        if(index != -1){
            tmp = tmp.substring(0, index);
        }
        return tmp;
    }

    public void setSql(String sql) {
        this.sql = sql;
    }

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public String getDb() {
        return db;
    }

    public void setDb(String db) {
        this.db = db;
    }

    public Integer getResourceId() {
        return resourceId;
    }

    public void setResourceId(Integer resourceId) {
        this.resourceId = resourceId;
    }
}
